package com.vcredit.creditcat.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.vcredit.creditcat.framework.pagination.Page;
import com.vcredit.creditcat.service.RedisManageService;
import com.vcredit.creditcat.vo.RedisResultVo;

@Controller
@RequestMapping("/redis")
public class RedisManageController extends BaseController {
	@Autowired
	private RedisManageService redisManageService;

	@RequestMapping("/list")
	public String list(HttpServletRequest request) {
		return "redis/redis";
	}

	@ResponseBody
	@RequestMapping("/findAllKey")
	public Page<RedisResultVo> findAllKey(HttpServletRequest request) {
		return redisManageService.queryAllKey();
	}

	@ResponseBody
	@RequestMapping("/delete")
	public String delete(String keys, HttpServletRequest request) {
		redisManageService.delete(keys);
		return SUCCESS;
	}

	@ResponseBody
	@RequestMapping("/removeAll")
	public String removeAll(HttpServletRequest request) {
//		redisManageService.removeAll();
		return SUCCESS;
	}
}
